<!-- 图表页面 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>智能合约</title>
    <link href="../../../../../lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="../../../../../lib/ui/js/plugins/datepicker/bootstrap-datetimepicker.min.css">
    <link rel="stylesheet" href="../../../../../lib/ui/js/plugins/bootstrap-table/bootstrap-table.min.css">
    <link rel="stylesheet" href="../../../../../lib/layui/css/layui.css">
    <link rel="stylesheet" href="../../../../../content/pc/sysmgt/blockchainManagement/blockchainManagement.css"/>
    <style>
        .right-container{
            background-image: url(../../../../../lib/ui/img/background-image.png);
            background-repeat: no-repeat;
            background-size: 100% 100%;
        }
        .main-container{
            height: calc(100% - 120px);
            margin-top: 12px;
            background-color: #fff;
            margin: 20px 8%;
        }
        .second-container{
            background-color: rgba(221, 227, 253,0.1);
        } 
        .first-level{
            width:100%;
        }
        .second-level{
            width:100%;
            height: calc(100% - 230px);
            overflow:auto;
        }
        .ideTable{
            border-collapse: collapse;
            border-spacing: 0;
            position: relative;
            table-layout: fixed;
            width: 100%;
            text-indent: initial;
            border: 1px solid #cfd5de;
            border-radius: 0;
        }
        .ideTable tr th{
            border-bottom: 1px solid #cfd5de;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        .ideTable thead{
            background-color: #e2efff;
        }
        .ideTable tbody{
            background-color: #fff;
        }
        .second-level{
            margin-top:10px;
        }
        .second-table-contanier{
            display: none;
            margin-top:10px;
        }
        .form-control{
            width: 160px !important;
        }
        .second-table{
            margin-top: 20px!important;
        }
        .navbar-coanter{
            height: 56px;
            /* width: 100%; */
            color: #14125e;
            background: hsla(0,0%,100%,.5);
            font-size: 25px;
            font-weight: bold;
            padding: 10px;
            margin-left:8%;
            margin-right:8%;
        }
        /* .title-h{
            font-size: 20px;
            height: 30px;
            line-height: 12px;
        } */
        .first-level{
            margin-top: 20px;
        }
        td span{
            color:#006eff;
            color: #006eff;
            cursor: pointer;
        }
        .right{
            float:right;
        }
        .left{
            float:left;
        }
        .total-text{
            color: rgba(0,0,0,.4);
            width: 200px;
            flex: 1;
            height: 70px;
            line-height: 70px;
        }
        .nav-container{
            display: flex;
            width: 100%;
            height: 70px;
        }
        .btn-primary{
            background-color: #006eff;
            border-color: #006eff;
        }
        .glyphicon-menu-left{
            top:4px;
        }
        .fixed-table-loading{
            display: none!important;
        }
        .layui-layer-content{
            padding:8px;
        }
        /* .layui-form option{
            height: 30px;
            font-size: 16px;
        } */
        .detail-container{
            width:100%;
            height:100%;
            padding: 6px 20px;
        }
        .inform-p{
            height: 26px;
            line-height: 26px;
            display: flex;
        }
        .inform-p span:first-child {
            font-size: 12px;            width: 120px;
        }
        .inform-p span{
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            display: inline-block;
            height: 26px;
            line-height: 26px;
        }
        .inform-p span:nth-child(2){
            flex: 1;
        }
        #addNew-template .layui-layer-content{
            height: 400px!important;
        }
        .layui-layer-page .layui-layer-content{
            padding:0;
        }
        .evidence-title-container{
            border: 1px solid #EAEAEA;
            background-color: #F9F9F9;
            height: 50px;
            line-height: 50px;
            font-size: 16px;
            padding-left: 20px;
            font-weight: 700;
        }
        .detail-part-container{
            padding-left: 30px;
        }
        .detail-part-container>p{
            height: 20px;
            line-height: 20px;
            color: #333;
            font-size: 14px;
            font-weight:700;
        }
        .vertical-line{
            background-color: #499EFF;
            display: inline-block;
            width: 4px;
            height: 20px;
            vertical-align: middle;
        }
        .detail-part-informationP{
            margin-top: 10px;
            padding: 0px 20px;
            color: #696969;
            margin-bottom: 10px;
        }
        .detail-part-informationP>p{
            line-height:1.5;
            /* color: #333; */
            font-size: 12px;
            padding-bottom: 6px;
            padding-right: 20px;
            padding-top: 6px;
        }
        .detail-part-informationP>p>span:first-child{
            margin-right:20px;
            text-align:right;
            width:100px;
            display: inline-block;
        }
        .detail-part-informationP>p>span:last-child{
            color: rgba(0,0,0,.9);
            text-align:left;
        }
        .center-title-container{
            width: 100%;
            height: 50px;
            line-height: 50px;
            display: flex;
        }
        .center-title-container>p{
            /* flex: 1; */
            width:50%;
            text-align: center;
            font-size: 14px;
            font-weight: 700;
        }
        .center-title-container>p:last-child{
            text-align: left;
            padding-left: 59px;
        }
        #block-informationD-share span:nth-child(2),#certificate-informationD-share span:nth-child(2),#contract-execution-informationD-share span:nth-child(2){
            color: rgba(0,0,0,.9);
            text-align:left;
            margin-right:20px;
            width:300px;
        }
        #block-informationD-share span:nth-child(3),#certificate-informationD-share span:nth-child(3),#contract-execution-informationD-share span:nth-child(3){
            color: rgba(0,0,0,.9);
            text-align:left;
            width:300px;
        }
        #block-informationD-share p,#certificate-informationD-share p,#contract-execution-informationD-share p{
           display:flex;
        }
        #block-informationD-share p span,#certificate-informationD-share p span,#contract-execution-informationD-share p span{
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        .colcorRed{
            color:red!important;
        }
    </style>
</head>
<body class="layui-view-body outside-container">
  <div class="second-container">
    <div class="right-container">
        <div class="navbar-coanter">
            <span class="glyphicon glyphicon-menu-left" onclick="window.history.back()"></span>
            #(record.get("attrib_03"))应用服务单元-业务管理
        </div>
        <div class="main-container">
            <p class="title-h">
                #(record.get("attrib_03"))应用服务单元-智能合约列表
                <button type="button" class="btn btn-primary right" onclick="addNewFun(this)" data-value="#(record.get('attrib_03'))">新增合约</button>
            </p>
            <!-- 列表区域 -->
            <div class="first-level">
                <table class="table table-hover ideTable">
                    <thead>
                        <tr>
                            <th style="width:110px;text-align:center;">业务类型</th>
                            <!-- <th style="width:110px">当前版本号</th>
                            <th>合约说明</th>
                            <th>订阅消息Topic</th>
                            <th>区块链</th>
                            <th>发送方</th>
                            <th>接收方</th> -->
                            <th style="width:200px;text-align:center;">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        #if(recordList!=null)
                            #for(x:recordList)
                                <tr>
                                    <td  title="#(x.get('attrib_06'))" style="text-align:center;">#(x.get("attrib_35"))</td>
                                    <!-- <td  title="#(x.get('attrib_07'))">#(x.get("attrib_07"))</td>
                                    <td  title="#(x.get('attrib_08'))">#(x.get("attrib_08"))</td>
                                    <td  title="#(x.get('attrib_33'))">#(x.get("attrib_33"))</td>
                                    <td  title="#(x.get('attrib_04'))">#(x.get("attrib_04"))</td>
                                    <td  title="#(x.get('attrib_31'))">#(x.get("attrib_31"))</td>
                                    <td  title="#(x.get('attrib_32'))">#(x.get("attrib_32"))</td> -->
                                    <td  style="text-align:center;">
                                        #if(roles==null || roles.toString().contains("管理"))
                                        #if(recordList!=null && x.get("attrib_35").contains("存证"))
                                        <span id="account-1" title="账号授权" onclick="permissionsFun(this,'存证')" data-value="#(x.get('attrib_12'))"  data-name="#(x.get('attrib_06'))" class="account-btn">账号授权</span>
                                        #end
                                        #if(recordList!=null && x.get("attrib_35").contains("共享"))
                                        <span id="account-1" title="账号授权" onclick="permissionsFun(this,'共享')" data-value="#(x.get('attrib_12'))" data-name="#(x.get('attrib_06'))" class="account-btn">账号授权</span>
                                        #end
                                        #end

                                        #if(recordList!=null && x.get("attrib_35").contains("存证"))
                                            <span id="ownership-2" title="上链存证数据查询检索" class="tableBtn" onclick="loadEvidenceTableFun(this)" >查询检索</span>
                                        #end
                                        #if(recordList!=null && x.get("attrib_35").contains("共享"))
                                            <span id="ownership-1" title="上链共享数据查询检索" class="tableBtn" onclick="loadShareTableFun(this)">查询检索</span>
                                        #end
                                        <!-- #if(recordList!=null && x.get("attrib_35").contains("存证"))
                                            <span id="ownership-2" title="存证" class="tableBtn" onclick="refreshFun(this,'存证')"  data-name="#(x.get('attrib_06'))">刷新</span>
                                        #end
                                        #if(recordList!=null && x.get("attrib_35").contains("共享"))
                                            <span id="ownership-1" title="共享" class="tableBtn" onclick="refreshFun(this,'共享')"  data-name="#(x.get('attrib_06'))">刷新</span>
                                        #end -->
                                        
                                    </td>
                                </tr>
                            #end
                        #end
                    </tbody>
                </table>
            </div>
            <div class="second-level">
                <div class="second-div-container">
                    <p id="title-name" class="title-h"></p>

                    <div  id="share-table" class="second-table-contanier">
                        <!-- 搜索框 -->
                        <form class="form-inline">
                            <div class="form-group">
                              <label class="sr-only" for="attrib_31">OrderID/StateID</label>
                              <input type="text" class="form-control" id="attrib_31" placeholder="OrderID/StateID">
                            </div>
                            <div class="form-group">
                              <label class="sr-only" for="attrib_32">发送方指令名称</label>
                              <input type="text" class="form-control" id="attrib_32" placeholder="发送方指令名称">
                            </div>
                            <div class="form-group">
                                <label class="sr-only" for="attrib_35">接收方指令名称</label>
                                <input type="text" class="form-control" id="attrib_35" placeholder="接收方指令名称">
                              </div>
                              <div class="form-group">
                                <label class="sr-only" for="attrib_12">发送方HASH</label>
                                <input type="text" class="form-control" id="attrib_12" placeholder="发送方HASH">
                              </div>
                              <div class="form-group">
                                <label class="sr-only" for="attrib_33">发送方创建时间</label>
                                <input type="text" class="form-control" id="attrib_33" placeholder="发送方创建时间">
                              </div>
                              <div class="form-group">
                                <label class="sr-only" for="attrib_58">发送方TxHASH</label>
                                <input type="text" class="form-control" id="attrib_58" placeholder="发送方TxHASH">
                              </div>
                              <div class="form-group">
                                <label class="sr-only" for="attrib_39">是否一致</label>
                                <input type="text" class="form-control" id="attrib_39" placeholder="是否一致">
                              </div>
                            <button  type="button" class="btn btn-primary" onclick="shareSearchFun()">搜索</button>
                          </form>
                        <table class="table table-hover ideTable second-table" id="share-tableSelf">
                        </table>
                    </div>
                    <!-- 查询检索表格 -->
                   <div id="evidence-table" class="second-table-contanier">
                      <!-- 搜索框 -->
                      <form class="form-inline">
                        <div class="form-group">
                          <label class="sr-only" for="ev12">存证数据HASH</label>
                          <input type="text" class="form-control" id="ev12" placeholder="存证数据HASH">
                        </div>
                        <div class="form-group">
                          <label class="sr-only" for="ev32">证据名称</label>
                          <input type="text" class="form-control" id="ev32" placeholder="证据名称">
                        </div>
                        <div class="form-group">
                            <label class="sr-only" for="ev33">创建时间</label>
                            <input type="text" class="form-control" id="ev33" placeholder="创建时间">
                          </div>
                          <div class="form-group">
                            <label class="sr-only" for="ev04">证据类型</label>
                            <input type="text" class="form-control" id="ev04" placeholder="证据类型">
                          </div>
                          <div class="form-group">
                            <label class="sr-only" for="ev58">TxHASH</label>
                            <input type="text" class="form-control" id="ev58" placeholder="TxHASH">
                          </div>
                        <button type="button" class="btn btn-primary" onclick="evidenceSearchFun()">搜索</button>
                      </form>
                    <table class="table table-hover ideTable second-table" id="evidence-tableSelf">
                    </table>
                   </div>
                </div>
            </div>
        </div>
    </div>   
  </div>
<script src="../../../../../lib/jquery/jquery.min.js"></script>
<script src="../../../../../lib/bootstrap/js/bootstrap.min.js"></script>
<script src="../../../../../lib/ui/js/plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="../../../../../lib/ui/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="../../../../../lib/ui/js/plugins/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
<script src="../../../../../lib/layui/layui.all.js"></script>
<script type="text/template" id="layui-form">
    <!-- 弹窗内部的表单 -->
    <form class="layui-form">
        <div class="layui-form-item">
          <label class="layui-form-label">授权账号</label>
          <div class="layui-input-block">
            <select name="account" lay-verify="required" id="account-select">
              <option value="">请选择授权账号</option>
            </select>
          </div>
        </div>
        <div class="layui-form-item" id="accountTypeContainer">
            <label class="layui-form-label">授权类型</label>
            <div class="layui-input-block">
              <select name="account-type" lay-verify="required" id="type-select">
                <option value="">请选择授权类型</option>
                <option value="1">运控</option>
                <option value="2">信关</option>
                <option value="0">取消授权</option>
              </select>
            </div>
          </div>
    </form>
</script>
<!-- 存证详情页面 -->
<script type="text/template" id="detail-template">
    <!-- 头部样式调整 -->
    <div class="evidence-title-container">
        <p>
            <span>存证数据详情</span>
        </p>
    </div>
    <div class="detail-container" id="detail-conatiner">
        <!-- 所属区块信息 -->
        <div class="detail-part-container">
            <p>
                <span class="vertical-line"></span>
                <span>所属区块信息</span>
            </p>
            <div class="detail-part-informationP"  id="block-informationD">
                <p>
                    <span>区块哈希</span>
                    <span id=" blockhash"  class="detail-pClass"></span>
                </p>
                <p>
                    <span>区块高度</span>
                    <span id="attrib_44" class="detail-pClass"></span>
                </p>
            </div>
        </div>
        <!-- 存证信息 -->
        <div class="detail-part-container" >
            <p>
                <span class="vertical-line"></span>
                <span>存证信息</span>
            </p>
            <div class="detail-part-informationP" id="certificate-informationD">
                <p>
                    <span>evdcHash</span>
                    <span id="attrib_12"  class="detail-pClass"></span>
                </p>
                <p>
                    <span>证据名称</span>
                    <span id="attrib_32"  class="detail-pClass"></span>
                </p>
                <p>
                    <span>创建时间</span>
                    <span id="attrib_33"  class="detail-pClass"></span>
                </p>
                <p>
                    <span>证据类型</span>
                    <span id="attrib_04"  class="detail-pClass"></span>
                </p>
                <p>
                    <span>TxHash</span>
                    <span id="attrib_58"  class="detail-pClass"></span>
                </p>
                <p>
                    <span>上链时间</span>
                    <span id="attrib_49"  class="detail-pClass"></span>
                </p>
                <p>
                    <span>备注</span>
                    <span id="attrib_37"  class="detail-pClass"></span>
                </p>
            </div>
        </div>
        <!-- 合约执行信息 -->
        <div class="detail-part-container" >
            <p>
                <span class="vertical-line"></span>
                <span>合约执行信息</span>
            </p>
            <div class="detail-part-informationP" id="contract-execution-informationD">
                <p>
                    <span>合约名称</span>
                    <span id="attrib_41"  class="detail-pClass"></span>
                </p>
                <p>
                    <span>版本号</span>
                    <span id="attrib_421"  class="detail-pClass"></span>
                </p>
                <p>
                    <span>合约说明</span>
                    <span id="attrib_422"  class="detail-pClass"></span>
                </p>
                <p>
                    <span>合约执行结果</span>
                    <span>success</span>
                </p>
            </div>
        </div>
    </div>
</script>
<!-- 共享详情页面 -->
<script type="text/template" id="share-detail-template">
    <!-- 头部样式调整 -->
    <div class="evidence-title-container">
        <p>
            <span>共享数据详情</span>
        </p>
    </div>
    <div class="center-title-container">
        <p>
            <span>发送方:</span>
            <span id="attrib_45"></span>
        </p>
        <p>
            <span>接收方:</span>
            <span id="attrib_48"></span>
        </p>
    </div>
    <div class="detail-container" id="detail-conatiner-share">
        <!-- 所属区块信息 -->
        <div class="detail-part-container">
            <p>
                <span class="vertical-line"></span>
                <span>所属区块信息</span>
            </p>
            <div class="detail-part-informationP"  id="block-informationD-share">
                <p>
                    <span>区块哈希</span>
                    <span class="detail-pClass" id="fsblockhash"></span>
                    <span class="detail-pClass"  id="jsblockhash"></span>
                </p>
                <p>
                    <span>区块高度</span>
                    <span class="detail-pClass" id="attrib_44"></span>
                    <span class="detail-pClass" id="attrib_47"></span>
                </p>
            </div>
        </div>
        <!-- 共享数据信息 -->
        <div class="detail-part-container" >
            <p>
                <span class="vertical-line"></span>
                <span>共享数据信息</span>
            </p>
            <div class="detail-part-informationP" id="certificate-informationD-share">
                <p>
                    <span>指令名称</span>
                    <span class="detail-pClass" id="attrib_32"></span>
                    <span class="detail-pClass" id="attrib_35"></span>
                </p>
                <p>
                    <span>指令hash</span>
                    <span class="detail-pClass" id="attrib_58"></span>
                    <span class="detail-pClass" id="attrib_58"></span>
                </p>
                <p>
                    <span>创建时间</span>
                    <span class="detail-pClass" id="attrib_33"></span>
                    <span class="detail-pClass" id="attrib_36"></span>
                </p>
                <p>
                    <span>TxHash</span>
                    <span class="detail-pClass" id="attrib_58"></span>
                    <span class="detail-pClass" id="attrib_59"></span>
                </p>
                <p>
                    <span>上链时间</span>
                    <span class="detail-pClass" id="attrib_49"></span>
                    <span class="detail-pClass" id="attrib_47"></span>
                </p>
                <p>
                    <span>备注</span>
                    <span class="detail-pClass" id="attrib_37"></span>
                    <span class="detail-pClass" id="attrib_38"></span>
                </p>
            </div>
        </div>
        <!-- 合约执行信息 -->
        <div class="detail-part-container" >
            <p>
                <span class="vertical-line"></span>
                <span>合约执行信息</span>
            </p>
            <div class="detail-part-informationP" id="contract-execution-informationD-share">
                <p id="attrib_41">
                    <span>合约名称</span>
                    <span class="detail-pClass"></span>
                </p>
                <p id="attrib_42">
                    <span>版本号</span>
                    <span class="detail-pClass"></span>
                </p>
                <p id="hysm">
                    <span>合约说明</span>
                    <span class="detail-pClass"></span>
                </p>
                <p id="attrib_44">
                    <span>合约执行结果</span>
                    <span class="detail-pClass">SUCCESS</span>
                </p>
            </div>
        </div>
    </div>
</script>
<!-- 新增合约 -->
<script type="text/template" id="addNew-template">
    <form class="layui-form" id="addNew-template-form"></form>
</script>
<script>
    //表格加载分页展示
    function loadShareTableFun(e){
        $('#title-name').text($(e).attr('title'));
        $('#share-table').show();
        $('#evidence-table').hide();
        let queryShareParamsObj={
            'attrib_31':null,//orderId
            'attrib_32':null,//发送方指令名称
            'attrib_35':null,//接收方指令名称
            'attrib_12':null,// 发送方HASH
            'attrib_33':null,// 发送方创建时间
            'attrib_58':null,// 发送方TxHASH
            'attrib_39':null,// 是否一致
            'pageSize':10,
            'pageNum':1,
        };
        shareTableFun(queryShareParamsObj);
    }
    function shareTableFun(queryShareParamsObj){
        $('#share-tableSelf').bootstrapTable('destroy');
        //共享接口table
        $('#share-tableSelf').bootstrapTable({
                url: '/sysadmin/remoteApp/selectBlockShareData',
                method: 'post',                      //请求方式（*）
                toolbar: '#toolbar',                //工具按钮用哪个容器
                striped: true,                      //是否显示行间隔色
                cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
                pagination: true,                   //是否显示分页（*）
                sortable: false,                     //是否启用排序
                sortOrder: "asc",                   //排序方式
                queryParams:function(params){
                    var temp = {//如果是在服务器端实现分页，limit、offset这两个参数是必须的
                        'attrib_31':queryShareParamsObj['attrib_31'],//orderId
                        'attrib_32':queryShareParamsObj['attrib_32'],//发送方指令名称
                        'attrib_35':queryShareParamsObj['attrib_35'],//接收方指令名称
                        'attrib_12':queryShareParamsObj['attrib_12'],// 发送方HASH
                        'attrib_33':queryShareParamsObj['attrib_33'],// 发送方创建时间
                        'attrib_58':queryShareParamsObj['attrib_58'],// 发送方TxHASH
                        'attrib_39':queryShareParamsObj['attrib_39'],// 是否一致
                        'pageSize':params.limit,
                        'pageNum':$('#share-tableSelf').bootstrapTable().bootstrapTable('getOptions').pageNumber,
                    };
		            return temp;
                },//queryShareParamsObj,//传递参数（*）
                sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
                pageNumber:1,                       //初始化加载第一页，默认第一页
                pageSize: 10,                       //每页的记录行数（*）
                pageList: [10, 20, 30, 40],        //可供选择的每页的行数（*）
                clickToSelect: true,                //是否启用点击选中行
                uniqueId: "attrib_58",  
                // smartDisplay:true,
                // showPaginationSwitch:true,//	默认为false隐藏每页数据条数选择，设为true显示
                responseHandler:function(res){
                    return {
                        "total":res.totalRow,
                        "rows":res.list
                        }
                },
                columns: [{
                        field: 'attrib_54',
                        title: '共享数据类别'
                    },
                    {
                        field: 'attrib_31',
                        title: 'OrderID/StateID'
                    },
                    {
                        field: 'attrib_32',
                        title: '发送方指令名称',
                        width:'140px'
                    },
                    {
                        field: 'attrib_35',
                        title: '接收方指令名称',
                        width:'140px'
                    },
                    {
                        field: 'attrib_12',
                        title: '发送方HASH',
                        width:'140px',
                         formatter:function(value,row){//只留前四位后四位，中间都用星号或点代替，且要显示出后四位来
                            if(value==undefined||value==null){
                                return '';
                            }else{
                                let lastValueBefore=value.substring(0,4);
                                let lastValueAfter=value.substring(value.length-4,value.length+1)
                                                let lastValue=lastValueBefore+'**'+lastValueAfter;
                                return lastValue;
                            }
                                          }
                    },
                    {
                        field: 'attrib_33',
                        title: '发送方创建时间',
                        width:'140px'
                    },
                    {
                        field: 'attrib_37',
                        title: '发送方备注',
                        width:'140px'
                    },
                    {
                        field: 'attrib_58',
                        title: '发送方TxHASH',
                        width:'140px',
                        formatter:function(value,row){//只留前四位后四位，中间都用星号或点代替，且要显示出后四位来
                            if(value==undefined||value==null){
                                return '';
                            }else{
                                let lastValueBefore=value.substring(0,4);
                                let lastValueAfter=value.substring(value.length-4,value.length+1)
                                                let lastValue=lastValueBefore+'**'+lastValueAfter;
                                return lastValue;
                            }
                                    }
                    },
                    {
                        field: 'price',
                        title: '操作',
                        width: 120,
                        align: 'center',
                        valign: 'middle',
                        formatter:function(value,row,index){
                            let res= "<span  class='detailSpan' onclick=\"showShareDetailModalFun('" + row['conflict_id'] + "')\" >详情</span>";
                            return res;
                        },
                            
                    },
                ]
        });
        $('#share-tableSelf').bootstrapTable('hideLoading');
    }
    function loadEvidenceTableFun(e){
        $('#title-name').text($(e).attr('title'));
            $('#share-table').hide();
            $('#evidence-table').show();
        let queryParamsObj={
            'attrib_12':null,//存证数据HASH
            'attrib_32':null,//证据名称
            'attrib_33':null,//创建时间
            'attrib_04':null,// 证据类型
            'attrib_58':null,// TxHASH
            'pageSize':10,
            'pageNum':1,
        };
        evidenceTableFun(queryParamsObj);
    }
        function evidenceTableFun(queryParamsObj){
            $('#evidence-tableSelf').bootstrapTable('destroy');
             //存证接口table
            $('#evidence-tableSelf').bootstrapTable({
                    url: '/sysadmin/remoteApp/selectBlockEvidenceData',
                    method: 'post',                      //请求方式（*）
                    toolbar: '#toolbar',                //工具按钮用哪个容器
                    striped: true,                      //是否显示行间隔色
                    cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
                    pagination: true,                   //是否显示分页（*）
                    sortable: false,                     //是否启用排序
                    sortOrder: "asc",                   //排序方式
                    queryParams:function(params){
                        var temp = {//如果是在服务器端实现分页，limit、offset这两个参数是必须的
                            'attrib_31':queryParamsObj['attrib_31'],//orderId
                            'attrib_32':queryParamsObj['attrib_32'],//发送方指令名称
                            'attrib_35':queryParamsObj['attrib_35'],//接收方指令名称
                            'attrib_12':queryParamsObj['attrib_12'],// 发送方HASH
                            'attrib_33':queryParamsObj['attrib_33'],// 发送方创建时间
                            'attrib_58':queryParamsObj['attrib_58'],// 发送方TxHASH
                            'attrib_39':queryParamsObj['attrib_39'],// 是否一致
                            'pageSize':params.limit,
                            'pageNum':$('#evidence-tableSelf').bootstrapTable().bootstrapTable('getOptions').pageNumber,
                        };
                        return temp;
                    },//queryShareParamsObj,//传递参数（*） ,//queryParamsObj,//传递参数（*）
                    sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
                    pageNumber:1,                       //初始化加载第一页，默认第一页
                    pageSize: 10,                       //每页的记录行数（*）
                    pageList: [10, 20, 30, 40],        //可供选择的每页的行数（*）
                    clickToSelect: true,                //是否启用点击选中行
                    uniqueId: "attrib_12",  
                    // smartDisplay:true,
                    // showPaginationSwitch:true,//	默认为false隐藏每页数据条数选择，设为true显示
                    responseHandler:function(res){
                        return {
                            "total":res.totalRow,
                            "rows":res.list
                            }
                    },
                    columns: [{
                            field: 'attrib_12',
                            title: '存证数据HASH',
                              formatter:function(value,row){//只留前四位后四位，中间都用星号或点代替，且要显示出后四位来
                                if(value==undefined||value==null){
                                    return '';
                                }else{
                                    let lastValueBefore=value.substring(0,4);
                                    let lastValueAfter=value.substring(value.length-4,value.length+1)
                                                    let lastValue=lastValueBefore+'**'+lastValueAfter;
                                    return lastValue;
                                }
                                          }
                        },
                        {
                            field: 'attrib_32',
                            title: '证据名称'
                        },
                        {
                            field: 'attrib_33',
                            title: '创建时间'
                        },
                        {
                            field: 'attrib_04',
                            title: '证据类型'
                        },
                        {
                            field: 'attrib_37',
                            title: '备注'
                        },
                        {
                            field: 'attrib_58',
                            title: 'TxHASH',
                            formatter:function(value,row){//只留前四位后四位，中间都用星号或点代替，且要显示出后四位来
                                if(value==undefined||value==null){
                                    return '';
                                }else{
                                    let lastValueBefore=value.substring(0,4);
                                    let lastValueAfter=value.substring(value.length-4,value.length+1)
                                    let lastValue=lastValueBefore+'**'+lastValueAfter;
                                    return lastValue;
                                }
                            }
                        },
                        {
                            field: 'price',
                            title: '操作',
                            width: 120,
                            align: 'center',
                            valign: 'middle',
                            formatter:function(value,row,index){
                                let res= "<span  class='detailSpan' onclick=\"showInfoDetailModalFun('" + row['conflict_id'] + "')\" >详情</span>";
                                return res;
                            },
                            
                        },
                    ]
                });
            }
        // 共享搜索事件
        function shareSearchFun(){
            $('#share-tableSelf').bootstrapTable('destroy');
            let queryShareParamsObj={
                'attrib_31':$('#attrib_31').val()==''?null:$('#attrib_31').val(),//orderId
                'attrib_32':$('#attrib_32').val()==''?null:$('#attrib_32').val(),//发送方指令名称
                'attrib_35':$('#attrib_35').val()==''?null:$('#attrib_35').val(),//接收方指令名称
                'attrib_12':$('#attrib_12').val()==''?null:$('#attrib_12').val(),// 发送方HASH
                'attrib_33':$('#attrib_33').val()==''?null:$('#attrib_33').val(),// 发送方创建时间
                'attrib_58':$('#attrib_58').val()==''?null:$('#attrib_58').val(),// 发送方TxHASH
                'attrib_39':$('#attrib_39').val()==''?null:$('#attrib_39').val(),// 是否一致
                'pageSize':10,
                'pageNum':1,
            };
            shareTableFun(queryShareParamsObj);
        }
        //存证搜索事件
        function evidenceSearchFun(){
            $('#evidence-tableSelf').bootstrapTable('destroy');
            let queryShareParamsObj={
                'attrib_12':$('#ev12').val()==''?null:$('#ev12').val(),//存证数据HASH
                'attrib_32':$('#ev32').val()==''?null:$('#ev32').val(),//证据名称
                'attrib_33':$('#ev33').val()==''?null:$('#ev33').val(),//创建时间
                'attrib_04':$('#ev04').val()==''?null:$('#ev04').val(),// 证据类型
                'attrib_58':$('#ev58').val()==''?null:$('#ev58').val(),// TxHASH
                'pageSize':10,
                'pageNum':1,
            };
            evidenceTableFun(queryShareParamsObj);
        }
        //存证弹窗
        function showInfoDetailModalFun(data){//row['attrib_12']  
            layer.open({
                type: 1, //可传入的值有：0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）。 若你采用layer.open({type: 1})方式调用，则type为必填项（信息框除外）
                title :false,
                area: ['50%', '600px'],
                closeBtn: 0,
                content:$('#detail-template').html(), //这里content是一个普通的String
                btn: ['关闭'],
                yes: function(index, layero){
                    layer.close(index);
                },
            });
            // //初始化***
            layer.ready(function(){
                $('#detail-conatiner .detail-pClass').text('');
                $.post("/sysadmin/remoteApp/evidenceDetailsByCid",{"cid":data},function(result){
                    for(let key in result){
                        if(result[key]==null || result[key]==undefined){
                            result[key]='';
                        }
                        let idName="#detail-conatiner "+"#"+key;
                        $(idName).text(result[key]);
                    }
                },"json");
            });
        }
        //共享详情  弹窗
        function showShareDetailModalFun(data){//row['attrib_12']  
            layer.open({
                type: 1, //可传入的值有：0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）。 若你采用layer.open({type: 1})方式调用，则type为必填项（信息框除外）
                title :false,
                area: ['65%', '600px'],
                closeBtn: 0,
                content:$('#share-detail-template').html(), //这里content是一个普通的String
                btn: ['关闭'],
                yes: function(index, layero){
                    layer.close(index);
                },
            });
            // //初始化***
            layer.ready(function(){
                $('#detail-conatiner-share .detail-pClass').text('');
                $.post("/sysadmin/remoteApp/shareDetailsByCid",{"cid":data},function(result){
                    for(let key in result){
                        if(result[key]==null || result[key]==undefined){
                            result[key]='';
                        }
                        // 共享数据信息 标红 
                        if(result['attrib_32']!==result['attrib_35']){
                            $('#detail-conatiner-share #attrib_32').addClass('colcorRed');
                            $('#detail-conatiner-share #attrib_35').addClass('colcorRed');
                        }
                        // if(result['attrib_58']!==result['attrib_35']){
                        //     $('#detail-conatiner-share #attrib_32').addClass('colcorRed');
                        //     $('#detail-conatiner-share #attrib_35').addClass('colcorRed');
                        // }
                        if(result['attrib_33']!==result['attrib_36']){
                            $('#detail-conatiner-share #attrib_33').addClass('colcorRed');
                            $('#detail-conatiner-share #attrib_36').addClass('colcorRed');
                        }
                        if(result['attrib_58']!==result['attrib_59']){
                            $('#detail-conatiner-share #attrib_58').addClass('colcorRed');
                            $('#detail-conatiner-share #attrib_59').addClass('colcorRed');
                        }
                        if(result['attrib_49']!==result['attrib_47']){
                            $('#detail-conatiner-share #attrib_49').addClass('colcorRed');
                            $('#detail-conatiner-share #attrib_47').addClass('colcorRed');
                        }
                        if(result['attrib_37']!==result['attrib_38']){
                            $('#detail-conatiner-share #attrib_37').addClass('colcorRed');
                            $('#detail-conatiner-share #attrib_38').addClass('colcorRed');
                        }


                        //合约执行信息
                        if(key=='attrib_41' || key=='attrib_42' || key=='attrib_43' || key=='attrib_44'){
                            let idName="#detail-conatiner-share "+"#"+key+" .detail-pClass";
                            $(idName).text(result[key]);
                        }else{
                            let idName="#detail-conatiner-share "+"#"+key;
                            $(idName).text(result[key]);
                        }
                    }
                },"json");
            });
        }
        function permissionsFun(e,type){
            let thisValue=$(e).attr('data-value');
            layer.open({
                type: 1, //可传入的值有：0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）。 若你采用layer.open({type: 1})方式调用，则type为必填项（信息框除外）
                title :'账号授权',
                area: type=='共享'?['800px', '350px']:['800px', '300px'],
                content:$('#layui-form').html(), //这里content是一个普通的String
                btn: ['提交', '取消'],
                yes: function(index, layero){
                    //按钮【按钮一】的回调
                    if(type=='存证' && $($("#account-select")[0]).val()==''){
                        layer.msg('请完善内容');
                    }else if(type=='共享' && $($("#account-select")[0]).val()=='' && $($("#type-select")[0]).val()==''){
                        layer.msg('请完善内容');
                    }else if(type=='存证' && $($("#account-select")[0]).val()!==''){
                        netSubmitFun('/sysadmin/remoteApp/setEvidenceAuthorize',{contractName:$('#account-1').attr('data-name'),cid:$($("#account-select")[0]).val()});//dataUrl   路径   dataObj   传参
                    }else if(type=='共享' && !$($("#account-select")[0]).val()=='' && !$($("#type-select")[0]).val()==''){
                        netSubmitFun('/sysadmin/remoteApp/setShareAuthorize',{contractName:$('#account-1').attr('data-name'),cid:$($("#account-select")[0]).val(),category:$($("#type-select")[0]).val()});//dataUrl   路径   dataObj   传参
                    }
                },
                cancel:function(){
                    console.log('取消');
                }
            });
            //初始化***
            layer.ready(function(){
                $.post("/sysadmin/remoteApp/getAuthorizeList",{"unitName": $('#account-1').attr('data-value')},function(result){
                    result.forEach((item,index)=>{
                        $($("#account-select")[0]).append("<option value='"+item.conflict_id+"'>"+item.attrib_03+"</option>");
                    });
                },"json");
            });
            if(type=='存证'){//显示授权账号
                $('#accountTypeContainer').hide();
            }
        }
        function netSubmitFun(dataUrl,dataObj){//dataUrl   路径   dataObj   传参
            $.post(dataUrl,dataObj,function(result){
                if(result.state=='ok'){
                    layer.msg('提交成功');
                    layer.closeAll();
                }else{
                    layer.msg('提交失败');
                }
            },"json");
        }
        //刷新
        function refreshFun(type,attrib6){
            // let thisDataName=$(e).attr('data-name');
            if(type=='存证'){
                $.post("/sysadmin/remoteApp/refreshBlockEvidenceData",{"contractName":attrib6},function(result){
                    // layer.msg(result.state=='ok'?'刷新成功':result.state);
                },"json");
            }else if(type=='共享'){
                $.post("/sysadmin/remoteApp/refreshBlockShareData",{"contractName": attrib6},function(result){
                    // layer.msg(result.state=='ok'?'刷新成功':result.state);
                },"json");
            }
        }
        //新增合约
        function addNewFun(){
            layer.open({
                type: 1, //可传入的值有：0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）。 若你采用layer.open({type: 1})方式调用，则type为必填项（信息框除外）
                title :'新增合约',
                area: ['800px', '400px'],
                content:$('#addNew-template').html(), //这里content是一个普通的String
                btn: ['提交','关闭'],
                yes: function(index, layero){
                    let domList=$("#addNew-template-form .addForm");
                    let paramObj={};
                    let showMessage=false;
                    $("#addNew-template-form .addForm").each(function(){
                        if(($($(this)[0]).val()=='' || $($(this)[0]).val()=='请选择') && $($(this)[0]).attr('data-required')==1){//1必填
                            showMessage=true;
                            layer.msg("请完善内容");
                        }
                        if(!showMessage){
                            paramObj[$($(this)[0]).attr('data-value')]=$($(this)[0]).val()=='请选择'?$($(this)[0]).val()=='':$($(this)[0]).val();
                        }
                    });
                    paramObj['code']='znhy';
                    console.log(paramObj);
                    $.post("/sysadmin/remoteApp/InsertFormData",JSON.stringify(paramObj),function(result){
                        layer.msg("已新增");
                        layer.closeAll();
                    },"json");
                },
            });
            // //初始化***
            // $('#addNew-template-form').empty();
            // let list=[//0 input 1 select   2    
            //     {
            //         name:'输入1',
            //         value:'',
            //         field:'attrib_01',
            //         type:'0',
            //         list:[],
            //         requried:1,//0 非必填   1必填
            //     },{
            //         name:'输入2',
            //         value:'',
            //         field:'attrib_02',
            //         type:'1',
            //         requried:0,
            //         list:[
            //             {
            //                 name:'1',
            //                 value:'a'
            //             },{
            //                 name:'2',
            //                 value:'b'
            //             },{
            //                 name:'3',
            //                 value:'c'
            //             },
            //         ]
            //     },
            // ];
            // list.forEach((item,index)=>{
            //     let str='';
            //     let inputType=item.type=='2'?'textarea':'text';
            //     if(item.type=='0'){//输入框
            //         str+="<div class='layui-form-item'><label class='layui-form-label'>"+item.name+"</label><div class='layui-input-block'>";
            //         str+="<input type='text' name='title' required   lay-verify='required' placeholder='请输入' autocomplete='off' class='layui-input addForm' data-value='"+item.field+"' data-required="+item.requried+">";
            //         str+="</div></div>";
            //         $('#addNew-template-form').append(str);
            //     }else if(item.type=='1'){//下拉框
            //         str+="<div class='layui-form-item' pane><label class='layui-form-label'>"+item.name+"</label><div class='layui-input-block'>";
            //         str+="<select name='account' lay-verify='required' class='addForm' data-value='"+item.field+"' data-required="+item.requried+"><option>请选择</option>";
            //         (item.list).forEach((itemList,itemIndex)=>{
            //             str+="<option value='"+itemList.value+"'>"+itemList.name+"</option>";
            //         });
            //         str+="</select></div></div>";
            //         $('#addNew-template-form').append(str);
            //     }else if(item.type=='2'){//文本域
            //         str+="<div class='layui-form-item'><label class='layui-form-label'>"+item.name+"</label><div class='layui-input-block'>";
            //         str+="<textarea name='' placeholder='请输入内容' class='layui-textarea addForm' data-value='"+item.field+"' data-required="+item.requried+"></textarea>";
            //         str+="</div></div>";
            //         $('#addNew-template-form').append(str);
            //     }
            // });
            layer.ready(function(){
                $('#addNew-template-form').empty();
                $.post("/sysadmin/remoteApp/selectFormDataFieldByCode",{"code":'znhy'},function(result){
                    result.forEach((item,index)=>{
                        let str='';
                        let inputType=item.type=='2'?'textarea':'text';
                        if(item.type=='textbox'){//输入框
                            str+="<div class='layui-form-item'><label class='layui-form-label'>"+item.title+"</label><div class='layui-input-block'>";
                            str+="<input type='text' name='title' required   lay-verify='required' placeholder='请输入' autocomplete='off' class='layui-input addForm' data-value='"+item.field+"' data-required="+item.requried+">";
                            str+="</div></div>";
                            $('#addNew-template-form').append(str);
                        }else if(item.type=='picker'){//下拉框
                            str+="<div class='layui-form-item' pane><label class='layui-form-label'>"+item.title+"</label><div class='layui-input-block'>";
                            str+="<select name='account' lay-verify='required' class='addForm' data-value='"+item.field+"' data-required="+item.requried+"><option>请选择</option>";
                            (item.list).forEach((itemList,itemIndex)=>{
                                str+="<option value='"+itemList.codename+"'>"+itemList.codename+"</option>";
                            });
                            str+="</select></div></div>";
                            $('#addNew-template-form').append(str);
                        }else if(item.type=='2'){//文本域
                            str+="<div class='layui-form-item'><label class='layui-form-label'>"+item.title+"</label><div class='layui-input-block'>";
                            str+="<textarea name='' placeholder='请输入内容' class='layui-textarea addForm' data-value='"+item.field+"' data-required="+item.requried+"></textarea>";
                            str+="</div></div>";
                            $('#addNew-template-form').append(str);
                        }
                    });
                },"json");
            });
        }
        $(document).ready(function() {
            let attrib6=$('.account-btn').attr('data-name');
            //刷新
            refreshFun('存证',attrib6);
            refreshFun('共享',attrib6);
            //下方共享
            loadShareTableFun($('#ownership-1'));
        }) 
</script>
</body>
</html>